home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
ww_tv.exe
/
TEDITOR3.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1991-11-22
|
5KB
|
130 lines
/****************************************************************************/
/* */
/* Copyright (c) 1991 Primatech Inc. */
/* */
/* All Rights Reserved */
/* */
/****************************************************************************/
// $config$=/MTEditor3.cpp
//
// $NAME$:
// ..Module Overview
//
// $GLOBAL PATHS$
// modules\all\TEditor3.cpp
// modules\c++\TEditor3.cpp
// objects\TEditor
//
// $0$
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Purpose: Additional function for the TurboVision TEditor class.
//
// Prototypes location: $/SEE(Editors.h)$
//
// Other Information:
//
// See also: $/SEE()$
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//$-1$
#if 0
//$1$
/**** MODIFICATIONS HISTORY ****/
Created: 08 November 1991 by John L. Swartzentruber
$SKIP START$
#endif
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/*+ +*/
/*+ I N C L U D E F I L E S +*/
/*+ +*/
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#define Uses_TEditor
#include <tv.h>
//$SKIP END$
//$2$
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/*+ +*/
/*+ # D E F I N E S C L A S S E S and T Y P E D E F S +*/
/*+ +*/
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
//$3$
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/*+ +*/
/*+ E X T E R N A L D E F I N I T I O N S +*/
/*+ +*/
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
//$4$
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/*+ +*/
/*+ S T A T I C D E F I N I T I O N S +*/
/*+ +*/
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
//$END$
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/*+ +*/
/*+ S T A T I C F U N C T I O N P R O T O T Y P E S +*/
/*+ +*/
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* EJECT */
//****************************************************************************
//
// Function $NAME$:
// TEditor::normalizeBuffer(ushort)
// $1$
//
// Purpose: To reset the "gapLen" and "bufSize" attributes. If
// necessary, data is moved to accomodate this. The actual
// size of the buffer is unchanged. Before calling this
// function, the buffer must be at least max(newSize,bufSize)
// bytes long.
//
// Return: True on success, False on failure
//
// Other information:
//
// This function should only be called by a setBufSize() function.
//
//$0$
//****************************************************************************
Boolean TEditor::normalizeBuffer(ushort newSize)
// $END$
{
ushort moveLen = bufSize - curPtr - gapLen + delCount;
ushort dest = newSize - moveLen;
ushort source = bufSize - moveLen;
if (dest >= curPtr) {
memmove(buffer + dest, buffer + source, moveLen);
bufSize = newSize;
gapLen = bufSize - bufLen;
return True;
}
return False;
}